'use strict';
var calculate_median = function(collection){
    let arr=collection.filter(
        function filtered(element,index,array){
            return index%2!==0;
        }
    );
    if(arr.length%2===0){
        return (arr[arr.length/2]+arr[arr.length/2-1])/2;
    }
    else {
        return arr[(arr.length-1)/2];
    }
};
module.exports = calculate_median;
